<%--
 *  File:    ProdEdiLitfecycle.jsp
 *  @Author: Langerwang 
 *  Date:    2001/01/14
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval" %>
<%@ taglib uri="/WEB-INF/custom-tag.tld" prefix="custom" %>

<%
  //init param
  Category cat = Category.getInstance("jsp.ProdEdiLitfecycle");  
  String privilegeCode = "10203,L203";
  String strModuleName = "PCM";
%>



<%
  String strProdId = (String)request.getParameter("prodid");  
  if(strProdId == null)
  {
    strProdId = (String)((HashMap)session.getAttribute("productinfo")).get("prodid").toString();
  }    
  
%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>

<html>
<head>
<title>ProdEditLifecycle</title>
<PageFlow:CheckPageFlow pageName="prodeditlifecycle"/>
<%@ include file="/inc/InitEdit.inc" %>
<%
  HashMap lifeInfo = (HashMap)pageContext.getAttribute("productlifecycle");
  if(lifeInfo == null)
  {
    lifeInfo = new HashMap();
  }
%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<%@ include file="/inc/NewCalendar.inc" %>

<script language="JavaScript">
function checkProdEditLife(form)
{
  if(!isNumberic(form.expiredays.value))
  {
    alert('<%=message.getMessageDesc("VALUE_MUST_BE_NUMBER",label.getLabelName("L_EffectiveDay",false))%>');
    return false;
  }     
  var datetempbegin= toDate(form.manufacturebegindate.value,"yyyy-MM-dd");
  var datetmpend=toDate(form.manufactureenddate.value,"yyyy-MM-dd");
  if(!((datetempbegin==ILLEGAL_DATE || datetempbegin==ILLEGAL_TIME) && (datetmpend==ILLEGAL_DATE || datetmpend==ILLEGAL_TIME)) && (toDate(form.manufacturebegindate.value,"yyyy-MM-dd").toString().length > 4 && toDate(form.manufactureenddate.value,"yyyy-MM-dd").toString().length > 4))
  {
    if(toDate(form.manufacturebegindate.value,"yyyy-MM-dd") >= toDate(form.manufactureenddate.value,"yyyy-MM-dd"))
    {
			alert("<%= message.getMessageDesc("CAN_NOT_LATE_THAN",label.getLabelName("L_ManufactureBeginDate",false), label.getLabelName("L_ManufactureEndDate",false)) %>");
	  	return;
	  }
  }
  return true;
}

function page_done()
{
  if(!checkProdEditLife(document.prodeditlifeform))
  {
    return;
  }   
    if(!checkNull(document.prodeditlifeform))
  		return;  
  	emptyToNull(document.prodeditlifeform);       
  document.prodeditlifeform.actionname.value = "done";
  isRunning = true;
  document.prodeditlifeform.submit();
}
function page_back()
{
  //parent.location.href="ProdMgmtFrm.jsp?<%= OvalTools.randomURL() %>";
  parent.up.page_goback();
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr> 
    <td valign=top>
      <table border=0 cellpadding=1 cellspacing=0 width="100%">
       <tbody> 
   <form name="prodeditlifeform" method="post" action="../../Dispatcher">
			   <input type="hidden" name="pagename" value="prodeditlifecycle">
			   <input type="hidden" name="actionname">
				 <input type="hidden" name="datelastupdated" value="<%=JspHelper.filterNull( new java.sql.Date(new java.util.Date().getTime()) )%>">
      <input type="hidden" name="prodid" value="<%=JspHelper.filterNull( strProdId )%>"> 
      <oval:hidden name="productinfo" property="orgid"/>
      <oval:hidden scope="session" property="languagecode"/>
      
    <tr> 
          <td bgcolor=#000000 style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px"> 
            <table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0 width="100%">
              <tr> 
                <td  bgcolor=#ffffff style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px"> 
                  <div id=div1 style="HEIGHT: 450px; OVERFLOW: auto">
                  
        <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">
              <input type="hidden" name="manufacturebegindate" value="<oval:write name="productlifecycle" property="manufacturebegindate" />" command="emptytonull" >
              <input type="hidden" name="manufactureenddate" value="<oval:write name="productlifecycle" property="manufactureenddate" />" command="emptytonull" >
              <input type="hidden" name="releaseddate" value="<oval:write name="productlifecycle" property="releaseddate" />" command="emptytonull" >
              <input type="hidden" name="orderingavailibilitydate" value="<oval:write name="productlifecycle" property="orderingavailibilitydate" />" command="emptytonull" >
              <input type="hidden" name="discontinuationdate" value="<oval:write name="productlifecycle" property="discontinuationdate" />" command="emptytonull" >
          <tr> 
            <td colspan="4" class="td_right"><a onclick="page_done();"><custom:button type="2" label="L_Save" imgsrc="save_btn.gif" border="0"/></a></td>
          </tr>
          <tr> 
            <td class="deepblue-left" colspan="4"><img src="../../images/<%= strLanguageCode %>/quote.gif"> 
              <%= label.getLabelName("L_LifeCycle") + label.getLabelName("L_Colon") %> </td>
          </tr>
          <tr> 
            <td class="td-text" width="106"><%= label.getLabelName("L_ManufactureBeginDate") + label.getLabelName("L_Colon") %></td>
            <td > 
              <input type="text" size="20" name="manufacturebegindate0" value='<custom:write name="productlifecycle" property="manufacturebegindate"  dataFormatName="dateformat"/>' onblur="manufacturebegindate.value=dateCheck(manufacturebegindate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');if(manufacturebegindate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_ManufactureBeginDate",false)) %>');manufacturebegindate.value=' ';manufacturebegindate0.value='';manufacturebegindate0.focus();}">
              <a onclick="javascript:c.show(this,'prodeditlifeform.manufacturebegindate0','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
            </td>
            <td class="td-text" width="160"><%= label.getLabelName("L_ManufactureEndDate") + label.getLabelName("L_Colon") %></td>
            <td > 
              <input type="text" size="20" name="manufactureenddate0" value='<custom:write name="productlifecycle" property="manufactureenddate" dataFormatName="dateformat"/>' onblur="manufactureenddate.value=dateCheck(manufactureenddate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');if(manufactureenddate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_ManufactureEndDate",false)) %>');manufactureenddate.value=' ';manufactureenddate0.value='';manufactureenddate0.focus();}">
              <a onclick="javascript:c.show(this,'prodeditlifeform.manufactureenddate0','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
            </td>
          </tr>
          <tr> 
            <td class="td-text"><%= label.getLabelName("L_ReleaseDate") + label.getLabelName("L_Colon") %></td>
            <td > 
              <input type="text" size="20" name="releaseddate0" value='<custom:write name="productlifecycle" property="releaseddate" dataFormatName="dateformat"/>' onblur="releaseddate.value=dateCheck(releaseddate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');if(releaseddate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_ReleaseDate",false)) %>');releaseddate.value=' ';releaseddate0.value='';releaseddate0.focus();}">
              <a onclick="javascript:c.show(this,'prodeditlifeform.releaseddate0','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
            </td>  
            <td class="td-text"><%= label.getLabelName("L_OrderingAvailabilityDate") + label.getLabelName("L_Colon") %></td>
            <td > 
              <input type="text" size="20" name="orderingavailibilitydate0" value='<custom:write name="productlifecycle" property="orderingavailibilitydate" dataFormatName="dateformat"/>' onblur="orderingavailibilitydate.value=dateCheck(orderingavailibilitydate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');if(orderingavailibilitydate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_OrderingAvailabilityDate",false)) %>');orderingavailibilitydate.value=' ';orderingavailibilitydate0.value='';orderingavailibilitydate0.focus();}">
              <a onclick="javascript:c.show(this,'prodeditlifeform.orderingavailibilitydate0','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
            </td>
          </tr>
          <tr> 
            <td class="td-text"><%= label.getLabelName("L_EffectiveDay") + label.getLabelName("L_Colon") %></td>
            <td > 
 			        <oval:text name="productlifecycle" property="expiredays" size="20"/>
            </td>
            <td class="td-text"><%= label.getLabelName("L_DiscontinuationDate") + label.getLabelName("L_Colon") %></td>
            <td > 
              <input type="text" size="20" name="discontinuationdate0" value='<custom:write name="productlifecycle" property="discontinuationdate" dataFormatName="dateformat"/>' onblur="discontinuationdate.value=dateCheck(discontinuationdate0.value, 'yyyy-MM-dd', '<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>');if(discontinuationdate.value<0){alert('<%= message.getMessageDesc("VALUE_MUST_BE_DATE",label.getLabelName("L_DiscontinuationDate",false)) %>');discontinuationdate.value=' ';discontinuationdate0.value='';discontinuationdate0.focus();}">
              <a onclick="javascript:c.show(this,'prodeditlifeform.discontinuationdate0','<%=JspHelper.filterNull( session.getAttribute("dateformat") )%>')"><custom:button type="3" label="L_Asterisk" imgsrc="Time.gif" border="0"/></a>
            </td>                        
          </tr>                 
        </table>
        </div> 
      </td>
    </tr>  
   </table>     
  </td>
 </tr>

  </form>
  </tbody>
</table>
       </td>
    </tr>
    <tr> 
      <td class="summary_top"></td>
    </tr>
    <tr> 
      <td class="td_center">
      <a onclick="page_back()"><custom:button type="1" label="L_Back" imgsrc="back.gif" border="0" style="width:60"/></a>
      </td>
    </tr>	 
</table>
</body>
</html>


